package com.ssm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ssm.dao.JrInfoMapper;
import com.ssm.model.JrInfo;
import com.ssm.service.JrInfoService;
import com.ssm.util.DataSourceInterceptor;
import com.ssm.util.DatabaseContextHolder;

@Service("jrInfoService")
public class JrInfoServiceImpl implements JrInfoService {

	@Autowired
	JrInfoMapper jrinfoMapper;

	@Override
	public List<JrInfo> getJrInfoByTime(String jrTime) {
		// TODO Auto-generated method stub
		return jrinfoMapper.getJrInfos(jrTime);
	}

	@Override
	public Integer addJrInfo(JrInfo info) {
		// TODO Auto-generated method stub
		return jrinfoMapper.insert(info);
	}

	@Override
	public Integer updateJrinfo(JrInfo info) {
		// TODO Auto-generated method stub
		return jrinfoMapper.updateByPrimaryKey(info);
	}

	@Override
	public Integer deleteJrinfo(Integer id) {
		// TODO Auto-generated method stub
		return jrinfoMapper.deleteByPrimaryKey(id);
	}

	@Override
	public List<JrInfo> getAllInfos() {
		// TODO Auto-generated method stub
		return jrinfoMapper.selectAll();
	}

	@Override
	public JrInfo getOneInfos(Integer id) {
		// TODO Auto-generated method stub
		return jrinfoMapper.selectByPrimaryKey(id);
	}

	@Override
	public Integer checkJrInfo(String jrName) {
		// TODO Auto-generated method stub
		Integer result=jrinfoMapper.CheckJrinfo(jrName).size();
		return result;
	}

}
